/*
 * Author  : Pallab
 * Program : crash.cxx
 *
 * 2011-12-28 14:07:25
 * I have not failed, I have just found 10000 ways that won't work.
 *
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait(double seconds) {
    double endtime = clock()+(seconds * CLOCKS_PER_SEC);
    while (clock() < endtime) {
        ;
    }
}

const double pii = (double)3.141592653589793238;
int N;
struct NODE {
    double x1;
    double y1;
    double r1;
    NODE(double x1=0., double y1=0., double r1=0.)
            : x1(x1),y1(y1),r1(r1) {
        ;
    }
};

inline void debug( vector< NODE > tree ) {
    printf("CURRENT TREE SIZE : %d\n",SZ(tree));
}

inline NODE margeCircles(NODE C1, NODE C2) {
    double xpoint = (C1.x1 + C2.x1 )/2.;
    double ypoint = (C1.y1 + C2.y1 )/2.;

    double R = sqrt( (C1.r1*C1.r1)+(C2.r1*C2.r1) ) ;
    return NODE( xpoint,ypoint, R);
}
#define eps 1e-9
inline bool canComunicate(NODE C1, NODE C2) {
    double xd = C1.x1 - C2.x1;
    double yd = C1.y1 - C2.y1;
    double dist = sqrt( (xd*xd) + (yd*yd) );
    return (  C1.r1-dist >= eps  ||  C2.r1-dist >=eps ) ;
}

vector< NODE> vi;
inline void dfs(NODE A) {

    vector< NODE > marge;
    bool found=false;
    marge.pb( A );
    for (int i=0;i<SZ(vi);  ) {
        if ( canComunicate(A,vi[i]) ) {
            marge.pb( vi[i] );
            vi.erase(vi.begin()+i);
            found=true;
        }
        else {
            ++i;
        }
    }
    if ( !found ) {
        vi.pb(A);
    }
    else {
        NODE combine;
        fo(i,SZ(marge)) {
            combine.x1+= marge[i].x1;
            combine.y1+= marge[i].y1;
            combine.r1+= ( marge[i].r1*marge[i].r1 ) ;
        }
        combine.x1/=SZ(marge);
        combine.y1/=SZ(marge);
        combine.r1 = sqrt( combine.r1 );
        dfs( combine );
    }
}

inline void Read() {
    vi.clear();
    NODE tmp;
    fo(i,N) {
        cin>>tmp.x1>>tmp.y1>>tmp.r1;
        dfs( NODE(tmp) );
    }

}
inline void Print() {
    cout<<SZ(vi)<<"\n";
}

int main() {
    while ( scanf("%d",&N)==1 ) {
        if ( N==0 )break;
        Read();
        Print();
    }

    return 0;
}
// kate: indent-mode cstyle; space-indent on; indent-width 0; 


